<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?=TEKS_HEADER?></title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<!-- (en) Add your meta data here -->
<!-- (de) Fügen Sie hier Ihre Meta-Daten ein -->

<link href="<?=base_url()?>css/central.css" rel="stylesheet" type="text/css"/>
<link href="<?=base_url()?>css/screen/login.css" rel="stylesheet" type="text/css"/>

<!--[if lte IE 7]>
<link href="<?=base_url()?>css/patches/patch_layout_draft.css" rel="stylesheet" type="text/css" />
<script defer type="text/javascript" src="<?=base_url()?>js/pngfix.js"></script>
<![endif]-->

<script type="text/javascript" src="<?=base_url()?>js/jquery-1.2.6.min.js"></script>

<script type="text/javascript">
$(function() {
    $("#reg").click(function(){
      $(".login_panel").hide();
      $("#reg_form").show();
    });
    
    $("#spg_username").focus();

    $("#login_form").submit(function() {
        if ( ($("#spg_username").val()=="") || ($("#spg_passwd").val()=="") ) {
            $("#spg_username").focus();
            $("#error_box").text('Username dan/atau password tidak boleh kosong.').show().fadeOut(3000);
        } else {
            var namauser = $("#spg_username").val();
            var passwd   = $("#spg_passwd").val();
        	 $.ajax({
        		   type: "POST",
        		   url: "<?php echo base_url();?>index.php/login/masuk/"+namauser+"/"+passwd,
        		   success: function(msg){
        		     if (msg=='not-sukses') {
        		    	$("#spg_username").focus();
        		     	$("#error_box").text('Username dan/atau password salah.').show().fadeOut(3000);
        		     } else {
        		    	 top.location="<?php echo base_url();?>index.php/welcome";
        		     }
        		   }
        		 });            
        }
        return false;
    });
    
    
    $("#reg_form").submit(function() {

        if ( ($("#reg_username, #reg_passwd, #reg_nip").val()=="") ) {
            $("#spg_username").focus();
            $("#error_box2").text('Username, nip, password tidak boleh kosong.').show().fadeOut(3000);
        } else if ( ($("#reg_passwd").val() != $("#reg_passwd2").val())) {
            $("#reg_passwd2").focus();
            $("#error_box2").text('password tidak sama.').show().fadeOut(3000);
        } else {
            var namauser = $("#reg_username").val();
            var passwd   = $("#reg_passwd").val();
            var nip      = $("#reg_nip").val();
             $.ajax({
                   type: "POST",
                   url: "<?php echo base_url();?>index.php/login/register/",
                   data: "namauser="+namauser+"&passwd="+passwd+"&nip="+nip,
                   success: function(msg){
                     if (msg=='not-sukses') {
                        $("#reg_nip").focus();
                         $("#error_box2").text('NIP belum terdaftar.').show().fadeOut(3000);
                     } else {
                         top.location="<?php echo base_url();?>index.php/login";
                     }
                   }
                 });            
        }
        return false;
    });
});
</script>

</head>
<body>
<div id="page_margins">
	<div id="page">
	  <div id="header"> <!-- begin: #header -->
	  <img src="<?=base_url()?>images/logo.png" style="position:absolute; margin-top:10px;" />
	  <div id="sistem"></div>
	  <div id="title"></div>
	  <div class="topnav-bg">
	   <div class="topnav-left">
	    <div class="topnav-right">
	      <div id="nav">
            <div class="wrapper">
              <ul class="menulist" id="listMenuRoot">
                <li class="menu" style="z-index: 1;">
                  <div class="tl"></div>
                  <a href="/">login</a>
                  <div class="tr"></div>
                </li>
                <!--<li class="menu" style="z-index: 1;">
                  <div class="tl"></div>
                  <a id="reg" href="#">Register</a>
                  <div class="tr"></div>
                </li>-->
              </ul>
            </div>
	       
          </div>
	    </div>
	   </div>
	  </div>
	  </div> <!-- end: #header -->
	  <div style="clear: both; float: right; margin-right: 15px; font-size: 11px; padding-bottom: 3px; color:#752c13;">
	  <script type="text/javascript">
		<!-- hide from old browsers
		  function GetDay(intDay){
			var DayArray = new Array("Minggu", "Senin", "Selasa", "Rabu", 
								 "Kamis", "Jum'at", "Sabtu");
			return DayArray[intDay];
			}
		
		  function GetMonth(intMonth){
			var MonthArray = new Array("Januari", "Pebruari", "Maret",
									   "April", "Mei", "Juni",
									   "Juli", "Agustus", "September",
									   "Oktober", "Nopember", "Desember") 
			return MonthArray[intMonth] 	  	 
			}
		  function getDateStrWithDOW(){
			var today = new Date()
			var year = today.getYear()
			if(year<1000) year+=1900
			var todayStr = GetDay(today.getDay()) + ", "
		
			var day = today.getDate()
			if(day<10) day = "0" + day
		
			todayStr += day + " " + GetMonth(today.getMonth()) 
			todayStr += " " + year
			return todayStr
			}
		//-->
		</script>

		<script type="text/javascript">
		<!-- hide from old browsers
			document.write(getDateStrWithDOW())
		//-->
		</script>
	  </div>
		
		<!-- begin: content area #main -->
<div id="main">
                    
            <!-- begin: #col3 static column -->
<div id="col3">
				<div id="col3_content" class="clearfix">
				<div class="rounded_panel">
					 <div class="bot-center">
					  <div class="right-panel">
					   <div class="bot-right">
					    <div class="left-panel">
						 <div class="bot-left">
					      <div class="top-left">
					       <div class="top-right">
						    <div class="container-panel">
						             
							  <div class="contentbox">   
								<div style="margin-left:auto; margin-right:auto; width:420px;">
								<div class="login_panel">
								 <div class="botLogin-center">
								  <div class="rightLogin-panel">
								   <div class="botLogin-right">
									<div class="leftLogin-panel">
									 <div class="botLogin-left">
									  <div class="topLogin-left">
									   <div class="topLogin-right">
										<div class="containerLogin-panel">
										  
										  <div class="contentboxLogin">
										  <form id="login_form" method="post">
										    <table width="100%" border="0" cellspacing="5" cellpadding="2">
                                                <tr>
                                                  <td width="39%" height="39">&nbsp;</td>
                                                  <td width="24%">&nbsp;</td>
                                                  <td width="37%">&nbsp;</td>
                                                </tr>
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>Username</td>
                                                  <td><input name="spg_username" id="spg_username" type="text" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>Password</td>
                                                  <td><input name="spg_passwd" id="spg_passwd" type="password" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td height="54">&nbsp;</td>
                                                  <td>&nbsp;</td>
                                                  <td><input name="login" type="submit" value="Login" class="log"/></td>
                                                </tr>
                                                <tr>
                                                  <td colspan="3" align="center"><div id="error_box">&nbsp;</div></td>
                                                </tr>
                                              </table>
											  </form>
										  </div>
                                          
										</div>
									   </div>
									  </div>
									 </div>
									</div>
								   </div>
								  </div>
								 </div> 
							    </div>
                                 <form id="reg_form" method="post" style="display:none">
                                 <h1>Register <span style="text-decoration:blink"> &raquo;&raquo;&raquo;&raquo; </span></h1>
                                            <table width="100%" border="0" cellspacing="5" cellpadding="2">                                            
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>Username</td>
                                                  <td><input name="reg_username" id="reg_username" type="text" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>NIP</td>
                                                  <td><input name="reg_nip" id="reg_nip" type="text" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>Password</td>
                                                  <td><input name="reg_passwd" id="reg_passwd" type="password" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td>&nbsp;</td>
                                                  <td>Ulangi Password</td>
                                                  <td><input name="reg_passwd2" id="reg_passwd2" type="password" size="20" /></td>
                                                </tr>
                                                <tr>
                                                  <td height="54">&nbsp;</td>
                                                  <td>&nbsp;</td>
                                                  <td><input name="login" type="submit" value="Register" class="log"/></td>
                                                </tr>
                                                <tr>
                                                  <td colspan="3" align="center"><div id="error_box2">&nbsp;</div></td>
                                                </tr>
                                              </table>
                                              </form>
								</div>
								
							  </div>
						    </div>
						   </div>
						  </div>
						 </div>
					    </div>
					   </div>
					  </div>
					 </div>
				  </div>
				  <div>
                    <div class="clearfix"></div>
			      </div>
				</div>
				<!-- IE column clearing -->
				<div id="ie_clearing">&nbsp;</div>
	  </div>
			<!-- end: #col3 -->
	  </div>
		<!-- end: #main -->
		
	
</div>
</div>
<!-- begin: #footer -->
<div id="footer">
<div style="margin-left:auto; margin-right:auto; text-align:center; padding:15px;"><?php echo TEKS_FOOTER; ?></div>
</div>
<!-- end: #footer -->
</body>
</html>